<!doctype html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>自动combo请求的demo</title>
    <script src="//g.tbcdn.cn/kissy/k/1.4.2/seed-min.js" charset="utf-8"></script>
    <script src="//a.tbcdn.cn/s/kissy/kg/uploader/3.0.2/meta/modules-min.js"></script>
</head>
<body>
<h2>自动combo请求的demo</h2>

<p>用于减少uploader的请求数</p>

<div class="grid">
    <input type="file" class="g-u" id="J_UploaderBtn" value="上传文件" name="Filedata" >
    <input type="hidden" id="J_Urls" name="urls" value="" />
</div>
<ul id="J_UploaderQueue">

</ul>
<script>
    var S = KISSY;
    if (S.Config.debug) {
        var srcPath = "../../../../";
        S.config({
            packages:[
                {
                    name:"gallery",
                    path:srcPath,
                    charset:"utf-8"
                }
            ]
        });
    }else{
        S.config("combine",true);
    }

    S.use('kg/uploader/3.0.2/index,kg/uploader/3.0.2/themes/default/index,kg/uploader/3.0.2/themes/default/style.css', function (S, Uploader,DefaultTheme) {
        //上传组件插件
        var plugins = 'kg/uploader/3.0.2/plugins/auth/auth,' +
                'kg/uploader/3.0.2/plugins/urlsInput/urlsInput,' +
                'kg/uploader/3.0.2/plugins/proBars/proBars';

        S.use(plugins,function(S,Auth,UrlsInput,ProBars){
            var uploader = new Uploader('#J_UploaderBtn',{
                //处理上传的服务器端脚本路径
                action:"upload.php"
            });
            //使用主题
            uploader.theme(new DefaultTheme({
                queueTarget:'#J_UploaderQueue'
            }))
                    //验证插件
            uploader.plug(new Auth({
                        //最多上传个数
                        max:3,
                        //图片最大允许大小
                        maxSize:100,
                        allowExts:"png"
                    }))
                     //url保存插件
                    .plug(new UrlsInput({target:'#J_Urls'}))
                    //进度条集合
                    .plug(new ProBars())
            ;
        });
    })
</script>
</body>
</html>